package code.remote {

import com.adobe.crypto.MD5;

import mx.rpc.events.ResultEvent;
	

public class UserRegisterRequest extends AbstractRequest {
	
	private static const REQUEST_TYPE: String = "user_register";
	
	private var username: String;
	private var password: String;
	private var email: String;
	
	/**
	 * @param password non MD5 hashed text
	 */
	public function UserRegisterRequest(username: String, password: String, email: String) {
		super(REQUEST_TYPE);
		
		this.username = username;
		this.password = password;
		this.email = email;
	}
	
	protected final override function getXmlData(): String {
		return 	"<Request><User>" +
					"<Username><![CDATA[" + this.username + "]]></Username>" +
					"<Password><![CDATA[" + MD5.hash(this.password) + "]]></Password>" +
					"<Email><![CDATA[" + this.email + "]]></Email>" +
				"</User></Request>";
	}
	
	protected final override function onResult(event: ResultEvent): void {
		// nothing to do
	}
	
}
}
